package com.oa.tools.dao;


import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.oa.tools.TkMapper;
import com.oa.tools.entity.OrgElementWithPerson;

public interface OrgElementWithPersonDAO  extends TkMapper<OrgElementWithPerson>{
	
	/**
	 * 查询element 关联 person 表
	 * @return
	 */
	@Select(value = { "select e.*,p.fd_mobile_no,p.fd_work_phone,p.fd_sex,p.fd_email from sys_org_element e \r\n" + 
			"left join sys_org_person p on e.fd_id = p.fd_id\r\n" + 
			"where e.fd_is_available = 1" })
	List<OrgElementWithPerson> selectOrgWithPerson();
	
	
	@Select(value = { "select e.*,p.fd_mobile_no,p.fd_work_phone,p.fd_sex,p.fd_email,p.fd_email,p.fd_login_name,l.fd_name fd_staffing_level_name from sys_org_element e\r\n" + 
			"      left join sys_org_person p on e.fd_id = p.fd_id\r\n" + 
			"      left join sys_org_staffing_level l on l.fd_id = p.fd_staffing_level_id\r\n" + 
			"where e.fd_is_available = 1 and p.fd_mobile_no = #{mobile}" })
	OrgElementWithPerson selectOneOrgWithPerson(@Param(value = "mobile") String mobile);
	
}